package com.yuexun.dhdoctor.module.personalPlan.presenter.impl;


import com.yuexun.dhdoctor.module.personalPlan.model.IOtherPlanModel;
import com.yuexun.dhdoctor.module.personalPlan.presenter.IOtherPlanPresenter;
import com.yuexun.dhdoctor.module.personalPlan.ui.view.IOtherPlanView;

import java.util.Map;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by work-jx on 2016/9/8.
 */
public class OtherPlanPresenter implements IOtherPlanPresenter {
    private IOtherPlanView view;
    private IOtherPlanModel model;

    //记录Log
//    private final Logger log = ProUtil.getLogger(LoginPresneter.class);

    public OtherPlanPresenter(IOtherPlanModel model, IOtherPlanView view) {
        this.model = model;
        this.view = view;
    }

    @Override
    public void getOtherTaskDetail(Map<String, String> praise) {
        model.getOtherTaskDetail(praise)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<String>() {

                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onNext(String s) {
                       view.showOtherTask(s);
                    }
                });
    }
}
